#include"JsonKeysConfig.h"

JsonKeysConfig::JsonKeysConfig(
	const QList<QString>& parentKeys,
	const QString& SongHashKey,
	const QString& songNameKey,
	const QString& musicTypeKey,
	const QString& payType,
	const QString& singerNameKey,
	const QString& url
) :
m_parents(parentKeys),
m_songKeys(
	{
		{SongKeys::SongHash,SongHashKey},
		{SongKeys::SongName,songNameKey},
		{SongKeys::Extname,musicTypeKey},
		{SongKeys::Pay_type,payType},
		{SongKeys::SingerName,singerNameKey},
		{SongKeys::Url,url}
	}
){}

JsonKeysConfig::JsonKeysConfig()
{
}

JsonKeysConfig::JsonKeysConfig(const QStringList& parentKeys, const OnlionMusicInfo& info):
	m_parents(parentKeys),
	m_songKeys(
		{
			{SongKeys::SongHash,info.songHash},
			{SongKeys::SongName,info.songName},
			{SongKeys::Extname,info.songExtname},
			{SongKeys::Pay_type,info.payType},
			{SongKeys::SingerName,info.singerName},
			{SongKeys::Duration_s,info.duration_s},
			{SongKeys::Url,info.url}
		}
	)
{}

void JsonKeysConfig::setSingerName(const QString& singerNameKey)
{
	m_songKeys.insert(SongKeys::SingerName, singerNameKey);
}

const QList<QString>& JsonKeysConfig::getParentKeys() const
{
	return m_parents;
}

const QMap<SongKeys, QString>& JsonKeysConfig::getSongKeys() const
{
	return m_songKeys;
}
